package com.qcby.lxt.framedemo.exception;


import com.qcby.lxt.framedemo.util.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName: LabRunException
 * @Description: 全局异常处理
 * @Author: lxt
 * @Date: 2019-05-23 10:34
 * @Version 1.0
 **/
@ControllerAdvice
@Slf4j
public class GlobalException {

    /**
     * @Description: 系统全局异常处理
     * @param e
     * @param request
     * @return: java.lang.Object 
     * @Author: lxt 
     * @Date: 2021/4/19 10:56
     */
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Object labRunException(Exception e , HttpServletRequest request) {
        log.error(e.getMessage(),e);
        return AjaxResult.error(e.getMessage());
    }
}
